package com.avecsys.quotemanager.ui.components;

import java.io.Serializable;

import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;

import com.icesoft.faces.context.effects.JavascriptContext;

public class MessageDialog implements Serializable
{

	private String dialogWidgetVar;

	private String message;

	private String header;

	private String requestJSON;

	/**
	 * @return the requestJSON
	 */
	public String getRequestJSON()
	{
		return requestJSON;
	}

	/**
	 * @param requestJSON the requestJSON to set
	 */
	public void setRequestJSON(String requestJSON)
	{
		this.requestJSON = requestJSON;
	}

	public MessageDialog()
	{
		super();
	}

	public MessageDialog(String dialogWidgetVar)
	{
		super();
		this.dialogWidgetVar = dialogWidgetVar;
	}

	public MessageDialog(String dialogWidgetVar, String message, String header)
	{
		super();
		this.dialogWidgetVar = dialogWidgetVar;
		this.message = message;
		this.header = header;
	}

	public MessageDialog(String dialogWidgetVar, String message)
	{
		super();
		this.dialogWidgetVar = dialogWidgetVar;
		this.message = message;
	}

	/**
	 * @return the dialogWidgetVar
	 */
	public String getDialogWidgetVar()
	{
		return dialogWidgetVar;
	}

	/**
	 * @param dialogWidgetVar the dialogWidgetVar to set
	 */
	public void setDialogWidgetVar(String dialogWidgetVar)
	{
		this.dialogWidgetVar = dialogWidgetVar;
	}

	/**
	 * @return the message
	 */
	public String getMessage()
	{
		return message;
	}

	/**
	 * @param message the message to set
	 */
	public void setMessage(String message)
	{
		this.message = message;
	}

	/**
	 * @return the header
	 */
	public String getHeader()
	{
		return header;
	}

	/**
	 * @param header the header to set
	 */
	public void setHeader(String header)
	{
		this.header = header;
	}

	public void showDialog()
	{
		JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), getDialogWidgetVar()
				+ ".show();");
	}

	public void hideDialog(ActionEvent actionEvent)
	{
		JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), getDialogWidgetVar()
				+ ".hide();");
	}

	public void hideDialog()
	{
		JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), getDialogWidgetVar()
				+ ".hide();");
	}

}
